import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/main',
            name: 'main',
            component: () => import('../views/main'),
            children: [
                {
                    path: "/user/profile",
                    name: "user-profile",
                    component: () => import("../views/user/user-profile")
                },
                {
                    path: "/user/list",
                    name: "user-list",
                    component: () => import("../views/user/user-list"),
                    props: true
                },
                {
                    path: "/user/role",
                    name: "user-role",
                    component: () => import("../views/user/user-role"),
                },
                {
                    path: "/sample/vcom",
                    component: () => import("../views/sample/vcom"),
                },
                {
                    path: "/sample/icons",
                    component: () => import("../views/sample/icons"),
                }
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('../views/login')
        },
        {
            path: '/',
            redirect: "/main"
        },
        {
            path: '*',
            name: 'error',
            component: () => import('../views/error')
        }
    ]
});